package main

import (
	"fmt"
	"html/template"
	"net/http"
)

func main() {
	http.HandleFunc("/", handle)
	http.ListenAndServe(":80", nil)
}

func handle(w http.ResponseWriter, req *http.Request) {
	// 1.解析模板
	t, err := template.ParseFiles("./example.html")
	if err != nil {
		fmt.Println("template is fail, Please check it!, reason:", err)
		return
	}
	// 2.渲染模板
	name := "I love go language"
	t.Execute(w, name)

}
